In [2]:
%pylab inline
%qtconsole
from mpl_toolkits.mplot3d import Axes3D
from ipywidgets import interact, interactive
from IPython.display import clear_output, display, HTML
In [10]:
x = arange(-1,1,0.11)
y = arange(-10,10,0.11)
X, Y = meshgrid(x, y)
z = X+ 1j*Y
w = exp(z)
fig = figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X,Y,real(w))
ax.set_title('Parte Real')
fig = figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X,Y,imag(w))
ax.set_title('Parte Imaginaria')
fig = figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X,Y,abs(w))
ax.set_title('Modulo')
Out[10]:
In [28]:
subplot(121)
for yp in linspace(-pi,pi,10):
x = arange(-1,1,0.1)
y = [yp]*len(x)
plot(x,y,'r')
for xp in arange(-1,1,0.2):
y = arange(-pi,pi,0.1)
x = [xp]*len(y)
plot(x,y,'b')
xlabel('Real')
ylabel('Imaginario')
subplot(122)
for yp in linspace(-pi,pi,10):
x = arange(-1,1,0.1)
y = [yp]*len(x)
plot(exp(x)*cos(y),exp(x)*sin(y), 'r')
for xp in arange(-1,1,0.2):
y = arange(-pi,pi,0.01)
x = [xp]*len(y)
plot(exp(x)*cos(y),exp(x)*sin(y),'b')
xlabel('Real')
ylabel('Imaginario')
Out[28]:
In [44]:
R = 1
t = arange(0,10,0.01)
y = zeros(t.shape)
for i in range(100):
y = y+ cos(2*pi*t + rand()*2*pi)
plot(y)
ylim((-10,10))
Out[44]:
La suma aleatorio $$\sum_{i=1}^{100} cos(x + \phi_i)$$
In [33]:
def plot_cosine(A, B):
fig = figure()
ax = fig.add_axes([0, 0, 1, 1])
w = 5.
t = arange(0,10,0.01)
y = A*cos(w*t) + B*sin(w*t)
# prepare the axes limits
ax.set_xlim((0, 10))
ax.set_ylim((-10, 10))
ax.plot(t, y)
In [37]:
wid = interactive(plot_cosine, A=(-10.,10.), B=(-10.,10.))
display(wid)
In [31]:
M = matrix([
[1, 0 ,1],
[2, 3 ,4],
[3, 1, 1]
])
eig(M)
Out[31]: